package com.bite.www;//声明当前类在哪个包
class Person{
    private int age;
    private String name;

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String classname="heloo";//被static修饰的变量为静态变量放到方法区

    //使用private等修饰符封装
    public static void fun1(){//属于静态类方法

    }



    public Person(int age, String name) {
        this.age = age;
        this.name = name;
    }

}
public class TextDemo {
    public static void main(String[] args) {
        System.out.println(Person.classname);//使用类名就能访问静态成员变量，不用通过对象来访问
        Person p1=new Person(10,"zhangsan");
        System.out.println(p1.classname);
        System.out.println(Person.classname);
        p1.getName();
        System.out.println();
    }
}
